import instacne from "../request";
import type { Ref } from "vue";

/**
 * /home/recommendSubject/list
 * 首页专题推荐管理
 */
interface IRecommendSubjectListParams {
  productName?: string | Ref<string>;
  recommendStatus?: number | Ref<number>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}

interface IRecommendSubjectListItem {
  id: number;
  productId: number;
  productName: string;
  recommendStatus: number;
  sort: number;
}

interface IRecommendSubjecttListRes {
  list: IRecommendSubjectListItem[];
  pageNum: number;
  pageSize: number;
  total: number;
  totalPage: number;
}

const getRecommendSubjectList = (
  data?: IRecommendSubjectListParams
): Promise<IRecommendSubjecttListRes> => {
  return instacne.get("/home/recommendSubject/list", {
    params: data,
  });
};

export { getRecommendSubjectList };
export type { IRecommendSubjectListItem };
